import { reqAddressInfo,reqOrderInfo } from '@/api/index'

const trade = {
    state: {
        userAdress: [],
        orderInfo:{}
    },
    mutations: {
        GETUSERADRESS(state, userAdress) {
            state.userAdress = userAdress
        },
        GETORDERINFO(state,orderInfo){
            state.orderInfo = orderInfo
        }
    },
    actions: {
        //H获取用户地址信息
        async getUserAddress({ commit }) {
            let result = await reqAddressInfo()
            if (result.code == 200) {
                commit('GETUSERADRESS', result.data)
            }
        },
        async getOrderInfo({commit}){
            let result = await reqOrderInfo()
            if (result.code == 200) {
                commit('GETORDERINFO',result.data)
            }
        }
    },
    getters: {},
}

export default trade